<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
    <title>VForm Demo</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="https://ks3-cn-beijing.ksyun.com/vform2021/VFormRender.css?t=20210720">
    <style type="text/css">
    </style>
</head>
<body>

<div id="app">
    <v-form-render :form-json="formJson" :form-data="formData" :option-data="optionData" ref="vFormRef">
    </v-form-render>
    <el-button type="primary" @click="submitForm">Submit</el-button>
</div>

<script type="text/javascript">
  if (!!window.ActiveXObject || "ActiveXObject" in window) { //IE load polyfill.js for Promise
    var scriptEle = document.createElement("script");
    scriptEle.type = "text/javascript";
    scriptEle.src = "https://cdn.bootcss.com/babel-polyfill/6.23.0/polyfill.min.js"
    document.body.appendChild(scriptEle)
  }
</script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://ks3-cn-beijing.ksyun.com/vform2021/VFormRender.umd.min.js?t=20210720"></script>
<script>
	new Vue({
      el: '#app',
      data: {
        formJson: {"widgetList":[{"type":"picture-upload","icon":"picture-upload-field","formItemFlag":true,"options":{"name":"pictureupload21772","label":"picture-upload","labelWidth":null,"labelHidden":true,"disabled":false,"hidden":false,"required":false,"requiredHint":"","customRule":"","customRuleHint":"","uploadURL":"http://192.168.50.17:8080/file/uploadx","uploadTip":"","withCredentials":false,"multipleSelect":true,"showFileList":true,"limit":3,"fileMaxSize":5,"fileTypes":["jpeg","png"],"customClass":[],"labelIconClass":null,"labelIconPosition":"rear","labelTooltip":null,"onCreated":"","onMounted":"","onBeforeUpload":"","onUploadSuccess":"","onUploadError":"","onValidate":""},"id":"pictureupload21772"}],"formConfig":{"modelName":"","refName":"vForm","rulesName":"rules","labelWidth":80,"labelPosition":"left","size":"","labelAlign":"label-left-align","cssCode":"","customClass":"","functions":"","layoutType":"PC","onFormCreated":"","onFormMounted":"","onFormDataChange":""}},
        formData: {},
        optionData: {}
      },
      methods: {
        submitForm: function() {
          this.$refs.vFormRef.getFormData().then( function(formData) {
            // Form Validation OK
            alert( JSON.stringify(formData) )
          }).catch( function(error) {
            // Form Validation Failed
            alert(error)
          })
        }
      }
	});
</script>
</body>
</html>